﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="DMMAccount.aspx.cs" Inherits="Catering.yl.Daily.DMMAccount" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
     <link href="../../../Style/ZHJG/zhezhao.css" rel="stylesheet" type="text/css" />
    <script src="../../../Scripts/zhezhao.js" type="text/javascript"></script>
    <script src="../../../Scripts/jquery-1.4.1.js" type="text/javascript"></script>
    <link rel="stylesheet" type="text/css" href="../../../Style/center.css" />
    <script type="text/javascript" src="../../../Scripts/My97DatePicker/WdatePicker.js"></script>
    <script type="text/javascript">
        //显示添加
        function Add() {
            $("#txt_PName").val("");
            $("#txt_PType").val("");
            $("#txt_PManu").val("");
            $("#txt_PCCBH").val("");            
            //$("#txt_PCCRQ").val("");
            //$("#txt_PQYRQ").val("");
            $("#txt_PZCBH").val("");
            $("#txt_PZJNX").val("");
            $("#txt_PYJZ").val("");
            $("#txt_PJSZK").val("");
            $("#txt_PAZDD").val("");
            $("#txt_PUser").val("");
            $("#btnEdit").hide();
            $("#btnAdd").show();
            divshow("main", "bg");
        }
        //添加数据
        function btn_Add() {
            var txt_PName = $("#txt_PName").val();
            if (txt_PName == "") return;
            var txt_PType = $("#txt_PType").val();            
            var txt_PManu = $("#txt_PManu").val();
            var txt_PCCBH = $("#txt_PCCBH").val();
            var txt_PCCRQ = $("#txt_PCCRQ").val();
            var txt_PQYRQ = $("#txt_PQYRQ").val();
            var txt_PZCBH = $("#txt_PZCBH").val();
            var txt_PZJNX = $("#txt_PZJNX").val();
            var txt_PYJZ = $("#txt_PYJZ").val();
            var txt_PJSZK = $("#txt_PJSZK").val();
            var txt_PAZDD = $("#txt_PAZDD").val();
            var txt_PUser = $("#txt_PUser").val();
            var hdn_useDate = $("#hdn_useDate").val();
            var hdn_currentClassID = $("#hdn_currentClassID").val();
            var hdn_currentGroupID = $("#hdn_currentGroupID").val();

            $.ajax({
                type: "Post",
                url: "DMMAccount.aspx/Add",
                data: "{'PName':'" + txt_PName + "','PType':'" + txt_PType + "','PManu':'" + txt_PManu + "','PCCBH':'" + txt_PCCBH + "','PCCRQ':'" + txt_PCCRQ + "','PQYRQ':'" + txt_PQYRQ + "','PZCBH':'" + txt_PZCBH + "','PZJNX':'" + txt_PZJNX + "','PYJZ':'" + txt_PYJZ + "','PJSZK':'" + txt_PJSZK + "','PAZDD':'" + txt_PAZDD + "','PUser':'" + txt_PUser + "','hdn_useDate':'" + hdn_useDate + "','hdn_currentClassID':'" + hdn_currentClassID + "','hdn_currentGroupID':'" + hdn_currentGroupID + "'}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",

                success: function (data) {
                    if (data.d == "OK") {
                        alert("保存成功！");
                        window.location.href = window.location.href;
                    }
                }
            });
        }
        function Edit(cid) {
            $("#HidID").val(cid);

            $.ajax({
                type: "Post",
                url: "DMMAccount.aspx/Get",
                data: "{'_id':'" + cid + "'}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (data) {
                    $("#txt_id").val(data.d[0] == null ? "" : data.d[0]);
                    $("#txt_PName").val(data.d[1] == null ? "" : data.d[1]);
                    $("#txt_PType").val(data.d[2] == null ? "" : data.d[2]);
                    $("#txt_PManu").val(data.d[3] == null ? "" : data.d[3]);
                    $("#txt_PCCBH").val(data.d[4] == null ? "" : data.d[4]);
                    $("#txt_PCCRQ").val(data.d[5] == null ? "" : data.d[5]);
                    $("#txt_PQYRQ").val(data.d[6] == null ? "" : data.d[6]);
                    $("#txt_PZCBH").val(data.d[7] == null ? "" : data.d[7]);
                    $("#txt_PZJNX").val(data.d[8] == null ? "" : data.d[8]);
                    $("#txt_PYJZ").val(data.d[9] == null ? "" : data.d[9]);
                    $("#txt_PJSZK").val(data.d[10] == null ? "" : data.d[10]);
                    $("#txt_PAZDD").val(data.d[11] == null ? "" : data.d[11]);
                    $("#txt_PUser").val(data.d[12] == null ? "" : data.d[12]);

                    $("#btnEdit").show();
                    $("#btnAdd").hide();
                    divshow("main", "bg");
                }
            });
        }
        //修改数据
        function btn_Edit() {            
            var txt_PName = $("#txt_PName").val();
            if (txt_PName == "") return;
            var txt_PType = $("#txt_PType").val();
            var txt_PManu = $("#txt_PManu").val();
            var txt_PCCBH = $("#txt_PCCBH").val();
            var txt_PCCRQ = $("#txt_PCCRQ").val();
            var txt_PQYRQ = $("#txt_PQYRQ").val();
            var txt_PZCBH = $("#txt_PZCBH").val();
            var txt_PZJNX = $("#txt_PZJNX").val();
            var txt_PYJZ = $("#txt_PYJZ").val();
            var txt_PJSZK = $("#txt_PJSZK").val();
            var txt_PAZDD = $("#txt_PAZDD").val();
            var txt_PUser = $("#txt_PUser").val();
            var cid = $("#txt_id").val();

            $.ajax({
                type: "Post",
                url: "DMMAccount.aspx/Edit",
                data: "{'_id':'" + cid + "','PName':'" + txt_PName + "','PType':'" + txt_PType + "','PManu':'" + txt_PManu + "','PCCBH':'" + txt_PCCBH + "','PCCRQ':'" + txt_PCCRQ + "','PQYRQ':'" + txt_PQYRQ + "','PZCBH':'" + txt_PZCBH + "','PZJNX':'" + txt_PZJNX + "','PYJZ':'" + txt_PYJZ + "','PJSZK':'" + txt_PJSZK + "','PAZDD':'" + txt_PAZDD + "','PUser':'" + txt_PUser + "'}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (data) {
                    if (data.d == "OK") {
                        alert("保存成功！");
                        window.location.href = window.location.href;
                    }
                }
            });
        }
        </script>   
</head>
<body>
    <form id="form1" runat="server">        
        <input type="hidden" id="hdn_useDate" value='<%=Session["useDate"]%>' />
        <input type="hidden" id="hdn_currentClassID" value='<%=Session["ClassID"]%>' />
        <input type="hidden" id="hdn_currentGroupID" value='<%=Session["GroupID"]%>' />
        <asp:HiddenField ID="HidID" runat="server" />
         <div style="height: 36px; line-height: 40px; color:red; font-size: 13px; background-color:#0f4a98; width:998px; margin:auto"> 
            &nbsp;<%--<asp:Button ID="Button1" style="float:right; margin:8px 5px" runat="server" Text="导出Excel" />--%>&nbsp;当前位置：日报管理->设备管理台账
       </div>
        <div style="height: 36px; line-height: 40px; font-size: 13px; margin:auto;width:998px;background: url(../../../Images/div_h1_bg_02.gif);"> 
            <asp:Button ID="Button1" style="float:right; margin:8px 5px" runat="server" Text="导出Excel" CssClass="input_btn_a" />
            <input id="New" type="button" value="新增" style="float:right; margin:8px 5px" onclick="Add()" class="input_btn_a"/>
       </div>
        <div style="padding: 0px;text-align: center;height: 29px; margin-top:10px"> 
            <table cellpadding="0" cellspacing="0" style="border-left:1px solid #8b8888;border-top:1px solid #8b8888; text-align:center;font-size:12px;width:998px; margin:auto">
                    <thead>
                        <tr style="background:url(../../../Images/th_02bg.gif) repeat-x 0px 0px; height:29px; ">
                            <td style="border-bottom:1px solid #8b8888;border-right:1px solid #8b8888">序号
                            </td >
                            <td style="border-bottom:1px solid #8b8888;border-right:1px solid #8b8888">设备名称
                            </td>
                            <td style="border-bottom:1px solid #8b8888;border-right:1px solid #8b8888">规格型号
                            </td>
                            <td style="border-bottom:1px solid #8b8888;border-right:1px solid #8b8888">制造厂商
                            </td>
                            <td style="border-bottom:1px solid #8b8888;border-right:1px solid #8b8888">出厂编号(序列号)
                            </td>
                            <td style="border-bottom:1px solid #8b8888;border-right:1px solid #8b8888">出产日期
                            </td>
                            <td style="border-bottom:1px solid #8b8888;border-right:1px solid #8b8888">启用日期
                            </td>                        
                            <td style="border-bottom:1px solid #8b8888;border-right:1px solid #8b8888">资产编号
                            </td>  
                            <td style="border-bottom:1px solid #8b8888;border-right:1px solid #8b8888">折旧年限
                            </td> 
                            <td style="border-bottom:1px solid #8b8888;border-right:1px solid #8b8888">原值(元)
                            </td>
                            <td style="border-bottom:1px solid #8b8888;border-right:1px solid #8b8888">技术状况
                            </td>
                            <td style="border-bottom:1px solid #8b8888;border-right:1px solid #8b8888">安装地点
                            </td>                        
                            <td style="border-bottom:1px solid #8b8888;border-right:1px solid #8b8888">使用人
                            </td>  
                            <td style="border-bottom:1px solid #8b8888;border-right:1px solid #8b8888">操作
                            </td>                       
                        </tr>
                    </thead>
                    <tbody>
                        <asp:Repeater ID="Rep_Plan" runat="server" OnItemCommand="Rep_Plan_ItemCommand">
                            <ItemTemplate>
                                <tr>
                                    <td style="border-bottom:1px solid #8b8888;border-right:1px solid #8b8888">
                                        <%#Eval("tempId")%>                                    
                                    </td>
                                    <td style="border-bottom:1px solid #8b8888;border-right:1px solid #8b8888">
                                        <%#Eval("PName")%>
                                    </td>
                                    <td style="border-bottom:1px solid #8b8888;border-right:1px solid #8b8888">
                                        <%#Eval("PType")%>
                                    </td>
                                    <td style="border-bottom:1px solid #8b8888;border-right:1px solid #8b8888">
                                        <%#Eval("PManu")%>
                                    </td>
                                    <td style="border-bottom:1px solid #8b8888;border-right:1px solid #8b8888">
                                        <%#Eval("PCCBH")%>
                                    </td>
                                    <td style="border-bottom:1px solid #8b8888;border-right:1px solid #8b8888">
                                        <%#Eval("p_ccrq")%>
                                    </td>
                                    <td style="border-bottom:1px solid #8b8888;border-right:1px solid #8b8888">
                                        <%#Eval("p_qyrq")%>
                                    </td>
                                    <td style="border-bottom:1px solid #8b8888;border-right:1px solid #8b8888">
                                        <%#Eval("PZCBH")%>
                                    </td>
                                    <td style="border-bottom:1px solid #8b8888;border-right:1px solid #8b8888">
                                        <%#Eval("PZJNX")%>
                                    </td>
                                    <td style="border-bottom:1px solid #8b8888;border-right:1px solid #8b8888">
                                        <%#Eval("PYJZ")%>
                                    </td>
                                    <td style="border-bottom:1px solid #8b8888;border-right:1px solid #8b8888">
                                        <%#Eval("PJSZK")%>
                                    </td>
                                    <td style="border-bottom:1px solid #8b8888;border-right:1px solid #8b8888">
                                        <%#Eval("PAZDD")%>
                                    </td>
                                     <td style="border-bottom:1px solid #8b8888;border-right:1px solid #8b8888">
                                        <%#Eval("PUser")%>
                                    </td>
                                    <td style="border-bottom:1px solid #8b8888;border-right:1px solid #8b8888">                                        
                                       <img alt="" title="编辑" src="../../../Images/file.gif" style="cursor: pointer;" onclick="Edit('<%#Eval("id")%>')"/>
                                       <asp:ImageButton ToolTip="删除" ID="ImageButton1" runat="server" ImageUrl="../../../Images/trash.gif" OnClientClick="return confirm('确认删除？');"
                                        CommandArgument='<%#Eval("id")%>' CommandName="del" />
                                    </td>                                
                                </tr>
                            </ItemTemplate>
                        </asp:Repeater>
                    </tbody>
                </table>
            </div>
             <!--弹出层-->
        <div id="bg" class="bg">
        </div>
        <div id="main" class="center_div" style="width: 400px; height: 300px; left:50%;top:30%;margin:-150px 0px 0px -200px">
            <div class="div_0207" style="width: 398px; height: 100%; margin: 0px;">
                <h1>
                    <img src="../../../Images/cp_h1_03.gif" />添加设备管理</h1>
                <table width="100%" cellpadding="0" cellspacing="0">
                    <tr>
                        <td height="30" align="right">
                            设备名称:
                        </td>
                        <td>
                            <asp:HiddenField ID="txt_id" runat="server" />  
                            <asp:TextBox ID="txt_PName" runat="server" CssClass="input_bg" Width="100px"></asp:TextBox>                          
                        </td>
                        <td width="85" height="30" align="right">规格型号:
                        </td>
                        <td width="65" height="30" align="right">
                            <asp:TextBox ID="txt_PType" runat="server" CssClass="input_bg" Width="100px"></asp:TextBox>
                        </td>                        
                    </tr>
                    <tr>
                        <td height="0" align="right" class="auto-style1">制造厂商:
                        </td>
                        <td>
                            <asp:TextBox ID="txt_PManu" runat="server" CssClass="input_bg" Width="100px"></asp:TextBox>                          
                        </td>
                        <td width="85" height="30" align="right">出厂编号:
                        </td>
                        <td>
                            <asp:TextBox ID="txt_PCCBH" runat="server" CssClass="input_bg" Width="105"></asp:TextBox>                          
                        </td>               
                    </tr>  
                    <tr>
                        <td height="0" align="right" class="auto-style1">出厂日期:
                        </td>
                        <td>
                            <asp:TextBox ID="txt_PCCRQ" runat="server" CssClass="input_bg" Width="100px"></asp:TextBox>                          
                        </td> 
                        <td width="85" height="30" align="right">启用日期:
                        </td>
                        <td>
                            <asp:TextBox ID="txt_PQYRQ" runat="server" CssClass="input_bg" Width="105"></asp:TextBox>                          
                        </td>                                     
                    </tr>  
                    <tr>
                        <td height="0" align="right" class="auto-style1">资产编号:
                        </td>
                        <td>
                            <asp:TextBox ID="txt_PZCBH" runat="server" CssClass="input_bg" Width="100px"></asp:TextBox>                          
                        </td> 
                        <td width="85" height="30" align="right">折旧年限:
                        </td>
                        <td>
                            <asp:TextBox ID="txt_PZJNX" runat="server" CssClass="input_bg" Width="105"></asp:TextBox>                          
                        </td>                                     
                    </tr>  
                    <tr>
                        <td height="0" align="right" class="auto-style1">原价值(元):
                        </td>
                        <td>
                            <asp:TextBox ID="txt_PYJZ" runat="server" CssClass="input_bg" Width="100px"></asp:TextBox>                          
                        </td> 
                        <td width="85" height="30" align="right">技术状况:
                        </td>
                        <td>
                            <asp:TextBox ID="txt_PJSZK" runat="server" CssClass="input_bg" Width="105"></asp:TextBox>                          
                        </td>                                     
                    </tr>  
                    <tr>
                        <td height="0" align="right" class="auto-style1">安装地点:
                        </td>
                        <td>
                            <asp:TextBox ID="txt_PAZDD" runat="server" CssClass="input_bg" Width="100px"></asp:TextBox>                          
                        </td> 
                        <td width="85" height="30" align="right">使用人:
                        </td>
                        <td>
                            <asp:TextBox ID="txt_PUser" runat="server" CssClass="input_bg" Width="105"></asp:TextBox>                          
                        </td>                                     
                    </tr>                       
                </table>
                <table width="100%">
                    <tr>
                        <td height="30" align="right">
                            <input type="button" id="btnAdd" onclick="btn_Add()" class="input_btn_a" value="提交" />
                            <input type="button" id="btnEdit" onclick="btn_Edit()" class="input_btn_a" value="提交" />
                        </td>
                        <td>
                            <input type="button" id="but_Close" onclick='divhidel("main", "bg")' class="input_btn_a" value="关闭" />
                        </td>
                    </tr>
                </table>
            </div>
        </div>
    </form>
</body>
</html>
